import { configureStore } from "@reduxjs/toolkit";
import { useDispatch, useSelector } from "react-redux";
import collect from "./counterSlice";
import commentsSlice from "./comments";
//引入用户的reducer切片
import userReducer from "./userSliceReducer";
import  doctor from "./doctor";
const store = configureStore({
  reducer: {
    collect: collect,
    comments: commentsSlice,
    User: userReducer,
    Doctor: doctor
  },
});

export type RootState = ReturnType<typeof store.getState>;
export type AppDispatch = typeof store.dispatch;
//重写useDispatch和useSelector
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
export const useAppSelector = useSelector.withTypes<RootState>();
export default store;
